﻿#include <iostream>
#include "../common/common.h"

int main( void ) {
	cudaDeviceProp prop;
	int count;

	SAFE_CALL( cudaGetDeviceCount(&count) );
	for (int i=0; i < count; ++i) {
		SAFE_CALL( cudaGetDeviceProperties(&prop, i) );

		printf( " --- Thong tin cho device thu %d ---\n", i );
		printf( "Ten: %s\n", prop.name );
		printf( "Nang luc tinh toan: %d.%d\n", prop.major, prop.minor );
		printf( "Xung nhip: %d\n KHz", prop.clockRate );
		printf( "Copy overlap: " );
		if (prop.deviceOverlap)
			printf( "Co\n" );
		else
			printf( "Khong\n" );
		printf( "Kernel execition timeout : " );
		if (prop.kernelExecTimeoutEnabled)
			printf( "Co\n" );
		else
			printf( "Khong\n" );
		printf( " --- Thong tin bo nho cua device thu %d ---\n", i );
		printf( "Dung luong bo nho toan cuc: %ld\n", prop.totalGlobalMem );
		printf( "Dung luong bo nho constant: %ld\n", prop.totalConstMem );
		printf( "Texture Alignment: %ld\n", prop.textureAlignment );
		printf( " --- Thong tin multiprocessor cua device thu %d ---\n", i );
		printf( "So Multiprocessor: %d\n", prop.multiProcessorCount );
		printf( "Dung luong bo nho shared: %ld\n", prop.sharedMemPerBlock );
		printf( "So thanh ghi: %d\n", prop.regsPerBlock );
		printf( "So thread trong 1 warp: %d\n", prop.warpSize );
		printf( "So thread toi da cho 1 block: %d\n",
			prop.maxThreadsPerBlock );
		printf( "Kich thuoc block toi da: (%d, %d, %d)\n",
			prop.maxThreadsDim[0], prop.maxThreadsDim[1],
			prop.maxThreadsDim[2] );
		printf( "Kich thuoc grid toi da: (%d, %d, %d)\n",
			prop.maxGridSize[0], prop.maxGridSize[1],
			prop.maxGridSize[2] );
		printf( "\n" );
	}
}
